<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liuxg < 420695648@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

class TeacherValidate extends Validate
{
	protected $regex = ['zip' => '^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$'];
	
    protected $rule = [
        'name'  => 'require',
        'phone' => 'require|regex:zip|unique:user,user_login',
    ];
    protected $message = [
        'name.require' => '请填写姓名！',
		'phone.unique'  => '手机号已存在！',
        'phone.require' => '请填写手机号！',
        'phone.regex' => '手机号码格式不正确！',
    ];

	protected $scene = [
        'add'  => ['name', 'phone'],
        'edit' => ['name', 'phone.require','phone.regex'],
    ];
}